
const list = (function () {
    axios.defaults.baseURL = 'http://60.204.218.206:8088/'

    const loadData = async () => {
        let data = await axios({
            url: '/data/list.json'
        })
        // console.log(data);
        // return data


        // console.log(data.data)

        let res = data.data
        let strHtml = ``
        res.forEach(el => {
            strHtml+= `
            <a href='goodsinfo?id=${el.id}'>
            <div class="item">
            <img src="http://60.204.218.206:8088/${el.img}" alt="">
            <p>
                名称：<span>${el.pname}</span>
                
            </p>
            <p>
                价格：<span>${el.price}</span>
            </p>
        </div></a>`
        })
        $(".box").html(strHtml)
    }

    return {
        loadData

    }


})()

$(function () {
    list.loadData()

})


